*********************************** * * * */SYSTEM/START * * Raw Code * * Interpreted by Sandy Mossberg * * * * Copyright (C) 1988 * * by MicroSPARC, Inc. * * Concord, MA 01742 * * * *********************************** ; Equates: LCONST GEQU $F2 ;program code/data record cRELOC GEQU $F5 ;compressed reloc record SUPER GEQU $F7 ;super compressed reloc rec RELOC3 GEQU $01 ;relocate 3 bytes (SUPER) PRODOS GEQU $E100A8 ;ProDOS 16 call Start_File START ***************************************************************** * * Segment 1 Header: * Start_Head ANOP BYTECNT DC I4'$111' ;total size of segment= 273 RESSPC DC I4'$00' ;# zeros added at EOF= 0 LENGTH DC I4'$A6' ;size of loaded segment= 166 UNDEF1 DC I1'$FF' ;undefined LABLEN DC I1'$0A' ;maximum label length= 10 NUMLEN DC I1'$04' ;number length always= 4 VERSION DC I1'$02' ;OMF version= 2 BANKSIZE DC I4'$10000' ;maximum bank size= 65536 KIND DC I2'$00' ;type/attrib (static code) UNDEF2 DC I2'$00' ;undefined ORG DC I4'$00' ;load address (relocatable) ALIGN DC I4'$00' ;page alignment (unaligned) NUMSEX DC I1'$00' ;byte order (lo/hi) UNDEF3 DC I1'$00' ;undefined SEGNUM DC I2'$01' ;segment number= 1 ENTRY DC I4'$00' ;entry offset= 0 DISPNAME DC I2'$2C' ;offset of LOADNAME= 44 DISPDATA DC I2'$40' ;offset of segment body= 64 LOADNAME DC 10C' ' ;name of load segm (unused) SEGNAME DC 10C' ' ;name of this segm (unused) ***************************************************************** * * Segment 1 Body: * ;................................................................ ; ; Record 1 Operation Code and Data: ; DC I1'LCONST' ;operation code= LCONST DC I4'$A6' ;byte count= 166 ;................................................................ ; ; Record 1 Program Code: ; ; Equate data bank to program bank: Start_Body PHK PLB ; Calculate amount of usable RAM: PHA ;reserve work area on PHA ; stack (4 bytes) JSL >GoGetRAM-PO ;get size of usable RAM ; ;** relocated by SUPER LDA $03,S ;result left on stack CMP #4 BCC AltQuit ;less than 256K found ; Primary QUIT command: JSL PRODOS ;used if >= 256K usable RAM DC I2'$29' ;QUIT command code MQParmPtr DC I4'MQuitParm-PO' ;pointer to parmlist ; ;** relocated by cRELOC ; Alternate QUIT command: AltQuit JSL PRODOS ;used if < 256K usable RAM DC I2'$29' ;QUIT command code AQParmPtr DC I4'AQuitParm-PO' ;pointer to parmlist ; ;** relocated by cRELOC ; Primary QUIT parameter list: MQuitParm DC I4'MQuitName-PO' ;pointer to pathname ; ;** relocated by cRELOC DC I2'$00' ;return/restart flags ; Alternate QUIT parameter list: AQuitParm DC I4'AQuitName-PO' ;pointer to pathname ; ;** relocated by cRELOC DC I2'$00' ;return/restart flags ; Pathname of primary START file: MQuitName DC I1'$0F' ;length byte DC C'*/SYSTEM/FINDER' ; Pathname of alternate START file: AQuitName DC I1'$11' ;length byte DC C'*/SYSTEM/LAUNCHER' ; Call subroutine to calculate usable RAM: ; ; EXIT: usable RAM on stack bytes 1-4 (L-ML-MH-H): GoGetRAM JSL >GetRAM-PO ;get size of usable RAM ; ;** relocated by SUPER RTL ; Subroutine to calculate usable RAM: ; ; EXIT: usable RAM on stack bytes 4-7 (L-ML-MH-H): ;--> Transform stack into work area for calculations: GetRAM PHD ;save entry direct page PHA ;save return address PHA ; on stack TSC ;equate stack and TCD ; direct page STZ $0D ;zero storage bytes for STZ $0F ; RAM calculations ;--> Point to Memory Manager's allocated block records: LDA $E11600 TAX LDA $E11602 GR1 STX $01 ;pointers to block records STA $03 ; at $00-$03 ;--> Test block attributes: LDY #4 LDA [$01],Y ;get attributes AND #$0300 ;isolate purge level BNE GR2 ;block purgeable so skip it ;--> Calculate total size of unpurgeable (unusable) RAM: LDY #8 ;block unpurgeable LDA [$01],Y ;get block size lo CLC ; and save it ADC $0D ; at $0C-$0D of STA $0D ; direct page (also stack) INY ;bump index to INY ; hi order byte LDA [$01],Y ;get block size hi ADC $0F ; and save it STA $0F ; at $0E-$0F of GR2 LDY #$10 ; direct page (also stack) LDA [$01],Y ;get link lo to next TAX ; block record INY ;bump index to INY ; hi order byte LDA [$01],Y ;get link to to next record BNE GR1 ;not at last record ;--> Subtract from $100000000 to get total usable RAM: LDA #0 ;all block records checked TAX ; so calculate complement SEC ; of total block sizes SBC $0D ; stored at $0C-$0F STA $0D TXA SBC $0F STA $0F PLA ;restore return address and PLA ; direct page to entry PLD ; values (former $0C-$0F at RTL ; $04-$07 after RTL) PO EQU Start_Body-Start_Head ***************************************************************** * * Segment 1 Relocation Dictionary: * ;................................................................ ; ; Record 2 Operation Code and Data: ; DC I1'cRELOC' ;operation code= cRELOC DC I1'$04' ;# bytes to relocate= 4 DC I1'$00' ;bit-shift operator= none DC I2'MQParmPtr-PO' ;offset of code to reloc= 21 DC I2'MQuitParm-PO' ;offset to reloc addr= 35 ;................................................................ ; ; Record 3 Operation Code and Data: ; DC I1'cRELOC' ;operation code= cRELOC DC I1'$04' ;# bytes to relocate= 4 DC I1'$00' ;bit-shift operator= none DC I2'AQParmPtr-PO' ;offset of code to reloc= 31 DC I2'AQuitParm-PO' ;offset to reloc addr= 41 ;................................................................ ; ; Record 4 Operation Code and Data: ; DC I1'cRELOC' ;operation code= cRELOC DC I1'$04' ;# bytes to relocate= 4 DC I1'$00' ;bit-shift operator= none DC I2'MQuitParm-PO' ;offset of code to reloc= 35 DC I2'MQuitName-PO' ;offset to reloc addr= 47 ;................................................................ ; ; Record 5 Operation Code and Data: ; DC I1'cRELOC' ;operation code= cRELOC DC I1'$04' ;# bytes to relocate= 4 DC I1'$00' ;bit-shift operator= none DC I2'AQuitParm-PO' ;offset of code to reloc= 41 DC I2'AQuitName-PO' ;offset to reloc addr= 63 ;................................................................ ; ; Record 6 Operation Code and Data: ; DC I1'SUPER' ;operation code= SUPER DC I4'$04' ;# bytes left in record= 4 DC I1'RELOC3' ;type= RELOC3 DC I1'$01' ;# patches-1= 2 patches DC I1'$05' ;patch 1 offset= 5 DC I1'$52' ;patch 2 offset= 82 ;................................................................ ; ; Record 7 Operation Code: ; DC H'00' ;operation code= END END